package edu.hqu.demo.controller;

import edu.hqu.demo.pojo.Student;
import edu.hqu.demo.service.StudentSerivice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class PersonalController {
    @Autowired
    private StudentSerivice studentSerivice;

    @RequestMapping("/information")
    public String test1(Model model,HttpServletRequest request){
        Object sno = request.getSession().getAttribute("Sno");
        Student student = studentSerivice.getStudentInformation(sno.toString());
        model.addAttribute("msg",student);
        System.out.println(student);
        return "redirect:/personal.html";
    }

    @RequestMapping("/goPersonalPage")
    public String goPersonalPage(Model model,HttpServletRequest request){
        return "personal";
    }

    @RequestMapping("/toselect")
    public String test2(Model model,HttpServletRequest request){
        return "selectcourse";
    }

}


